3650 struct file {
3651   enum { FD_NONE, FD_PIPE, FD_INODE } type;
3652   int ref; // reference count
3653   char readable;
3654   char writable;
3655   struct pipe *pipe;
3656   struct inode *ip;
3657   uint off;
3658 };
3659 
3660 
3661 // in-core file system types
3662 
3663 struct inode {
3664   uint dev;           // Device number
3665   uint inum;          // Inode number
3666   int ref;            // Reference count
3667   int flags;          // I_BUSY, I_VALID
3668 
3669   short type;         // copy of disk inode
3670   short major;
3671   short minor;
3672   short nlink;
3673   uint size;
3674   uint addrs[NDIRECT+1];
3675 };
3676 
3677 #define I_BUSY 0x1
3678 #define I_VALID 0x2
3679 
3680 
3681 // device implementations
3682 
3683 struct devsw {
3684   int (*read)(struct inode*, char*, int);
3685   int (*write)(struct inode*, char*, int);
3686 };
3687 
3688 extern struct devsw devsw[];
3689 
3690 #define CONSOLE 1
3691 
3692 
3693 
3694 
3695 
3696 
3697 
3698 
3699 
